package com.lxg.service.userService;

import com.lxg.pojo.Books;
import com.lxg.pojo.Borrow;
import com.lxg.pojo.History;

import java.util.ArrayList;

public interface UserBorrowService {

    /**
     * 用户修改自身信息
     * @param username
     * @param password
     * @param name
     * @param sno
     * @param grade
     * @param email
     * @param phone
     */
    public boolean updateUser(String username, String password, String name,
                              String sno, String grade, String email,String phone,Integer uid);


    /**
     * 还书service
     * @param uid
     * @param bid
     * @return
     */
    public boolean ReturnBookService(Integer uid,Integer bid);

    /**
     * 借书service
     * @param uid
     * @param bid
     * @return
     */
    public boolean BorrowBookService(Integer uid,Integer bid);



    //申请借书，添加借阅记录
    public int addHistory(Integer uid,Integer bid,String bookname,String author,
                              String begintime,String endtime,Integer num,Integer status);


    //根据uid和bid查找借阅记录
    public History getHistoryByUidAndBid(Integer uid,Integer bid);


    //展示书架
    public ArrayList<Borrow> showMyBooks(Integer uid);

    public boolean addMyBook(Integer bid,Integer uid,String bookname,String author,Integer num,Integer status);

    public Borrow getBorrow(Integer bid,Integer uid);

    boolean updateBorrow(Integer bid,Integer uid, Integer num);

    boolean deleteBorrow(Integer bid,Integer uid);


    //更新借阅记录
    public boolean updateHistory(Integer uid,Integer bid,String endtime,Integer num);

    boolean deleteHistoryByUidAndBid(Integer uid, Integer bid);

    Integer isDeleted(Integer uid,Integer bid);

    boolean updateHistoryStatus(Integer uid, Integer bid);

    boolean updateBorrowStatus(Integer bid, Integer uid);

    Integer getHistoryStatus(Integer uid, Integer bid);
}
